#include <iostream>
#include <string>
#include <signal.h>
#include <sys/types.h>
#include <signal.h>

using namespace std;

// 出错打印错误信息并且退出
#define ERR_EXIT(m)         \
    do                      \
    {                       \
        perror(m);          \
        exit(EXIT_FAILURE); \
    } while (0)

    
int main(int argc, char *argv[])
{
    if (argc != 3)
    {
        // 不是三个参数退出
        cout << "kill proecsspid signum" << endl;
        return 1;
    }
    int signum = stoi(argv[1]);
    pid_t pid = stoi(argv[2]);

    int n = kill(pid, signum);
    if (n == -1)
    {
        ERR_EXIT("kill");
    }
    cout << "send signum " << signum << " to process " << pid << endl;
    return 0;
}